package com.lx.controller;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.lx.entity.Article;
import com.lx.mapper.ArticleMapper;
import com.lx.web.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;

/**
 * @Author: LiXiang
 * @Date: 2024/2/1
 * @Description:
 */
@RestController
@RequestMapping("/article")
public class ArticleController {

    @Autowired
    private ArticleMapper articleMapper;

    @GetMapping("/list")
    public Result getList(){
        System.out.println("31133");
        System.out.println("31133");
        List<Article> list=new ArrayList<>();
        for (int i = 0; i <4; i++) {
            Article article=new Article();
            article.setId(i);
            article.setTitle("test-"+i);
            list.add(article);
        }
        QueryWrapper<Article> queryWrapper=new QueryWrapper<>();
        List<Article> articleList = articleMapper.selectList(null);
        return Result.success(articleList);
    }


}
